package phone.example.com.a36kr.activity;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import java.util.ArrayList;

import phone.example.com.a36kr.R;
import phone.example.com.a36kr.adapter.registerviewpageradapter.RegisterViewPager;
import phone.example.com.a36kr.fragment.registerfragment.RegisterLoginFragment;
import phone.example.com.a36kr.fragment.registerfragment.RegisterLogonFragment;
import phone.example.com.a36kr.tools.BaseActivity;

/**
 * Created by dllo on 16/8/26.
 */
public class RegisterActivity extends BaseActivity{

    private TabLayout registerTb;
    private ViewPager registerVp;

    @Override
    protected int setLayout() {
        return R.layout.activity_register;
    }

    @Override
    protected void initView() {
        registerTb = bindView(R.id.register_tablayout);
        registerVp = bindView(R.id.register_vp);



    }

    @Override
    protected void initData() {

        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(new RegisterLoginFragment());//登录
        fragments.add(new RegisterLogonFragment());//注册
        RegisterViewPager registerViewPager = new RegisterViewPager(getSupportFragmentManager());
        registerViewPager.setFragments(fragments);
        registerVp.setAdapter(registerViewPager);
        registerTb.setupWithViewPager(registerVp);



    }
}
